<div class='right-cont wrap-coupon-code' ng-controller='CouponCodeList'>
	<div class='title'>优惠码管理<i class='fa fa-spin fa-spinner'></i></div>
	<div class='content'>
		<div class='box-ops clearfix'>
			<div class='box-btn'>
				<button class='btn btn-primary' data-toggle='modal' data-target='.modal.code-add'>添加</button>
			</div>
		</div>

		<div class='box-list'>
			<table class='table table-list'>
				<tr>
					<td>优惠码ID	<i class='fa fa-sort'></i></td>
					<td>优惠码		<i class='fa fa-sort'></i></td>
					<td>限制金额	<i class='fa fa-sort'></i></td>
					<td>抵扣金额	<i class='fa fa-sort'></i></td>
					<td>已使用数量	<i class='fa fa-sort'></i></td>
					<td>抵扣总金额	<i class='fa fa-sort'></i></td>
					<td>生成时间	<i class='fa fa-sort'></i></td>
					<td>截止时间	<i class='fa fa-sort'></i></td>
					<td>状态		<i class='fa fa-sort'></i></td>
					<td>操作		<i class='fa fa-sort'></i></td>
				</tr>
				<tr ng-repeat='item in list'>
					<td>{{item.id}}</td>
					<td>{{item.code}}</td>
					<td>{{item.limit_amount}}</td>
					<td>{{item.amount}}</td>
					<td>{{item.use_count}}</td>
					<td>{{item.use_count * item.amount}}</td>
					<td>{{item.create_date}}</td>
					<td>{{item.end_date}}</td>
					<td>
						<span class='label label-primary' ng-if='item.status == 1'>{{item.status_text}}</span>
						<span class='label label-warning' ng-if='item.status == 0'>{{item.status_text}}</span>
					</td>
					<td>
						<button class='btn btn-success btn-w-xs btn-xs' 
							ng-if='item.status == 0' ng-click='change_status(item.id, 1)'>
							启用
						</button>
						<button class='btn btn-warning btn-w-xs btn-xs' 
							ng-if='item.status == 1' ng-click='change_status(item.id, 0)'>
							禁用
						</button>
						<button class='btn btn-danger btn-xs btn-w-xs'
							ng-click='change_status(item.id, -1)'>
							删除
						</button>
					</td>
				</tr>
			</table>
			<div class='box-page' ng-bind-html='pageHtml'></div>
		</div>
	</div>

	<!--优惠码添加模态窗-->
	<div class='modal fade code-add'>
		<div class='modal-dialog'>
			<div class='modal-content'>	
				<div class='modal-header'>
					优惠码添加
					<a class='close' data-dismiss='modal'>&times;</a>
				</div>
				<div class='modal-body'>
					<table class='table-form'>
						<tr>
                    		<td class='td-label'>优惠码值:</td>
                    		<td>
                    			<input type='text' ng-model='aCode.code' class='form-control'>
                    		</td>
                    	</tr>
                    	<tr>
                    		<td class='td-label'>限制金额:</td>
                    		<td>
                    			<input type='number' ng-model='aCode.limit_amount' class='form-control'>
                    		</td>
                    	</tr>
                    	<tr>
                    		<td class='td-label'>抵扣金额:</td>
                    		<td>
                    			<input type='number' ng-model='aCode.amount' class='form-control'>
                    		</td>
                    	</tr>
                    	<tr>
                    		<td class='td-label'>截止日期:</td>
                    		<td>
                    			<input type='text' ng-model='aCode.end_date' class='form-control datepicker'>
                    		</td>
                    	</tr>
                    </table>
				</div>
				<div class='modal-footer'>
                    <button class='btn btn-primary btn-sm btn-w-sm' ng-click='create_code()'>确认</button>
                    <button class='btn btn-default btn-sm btn-w-sm' data-dismiss='modal'>取消</button>
                </div>
			</div>
		</div>
	</div>
</div>